package com.diaohw.module.log.controller;

import com.diaohw.module.log.obj.entity.DbLog;
import com.diaohw.module.log.obj.entity.RequestLog;
import com.diaohw.module.log.service.LogStorageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "日志插入")
@RestController
@RequestMapping("/log-storage")
public class LogStorageController {


    @Resource
    private LogStorageService logStorageService;

    @Operation(summary = "HTTP 日志插入")
    @PostMapping("/http")
    public void http(@RequestBody RequestLog log) {
        logStorageService.storageHttpLog(log);
    }

    @Operation(summary = "SQL日志 插入")
    @PostMapping("/db")
    public void db(@RequestBody DbLog log) {
        logStorageService.storageDBLog(log);
    }
}
